﻿<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:controls="clr-namespace:Corina.Controls.Win;assembly=Corina.Controls.Win"
      xmlns:converters="clr-namespace:Corina.Converters.Win;assembly=Corina.Converters.Win"
      xmlns:localViewmodel="clr-namespace:Corina.Addins.Spyrs"
      FontSize="14">
    <Page.DataContext>
        <localViewmodel:SpyrsViewmodel />
    </Page.DataContext>
    <Page.Resources>
        <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
        <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" />
    </Page.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBox AcceptsReturn="True"
                 Text="{Binding HtmlContent,
                                Mode=TwoWay,
                                UpdateSourceTrigger=PropertyChanged}"
                 TextWrapping="Wrap"
                 Visibility="{Binding ShowHtmlContent,
                                      Converter={StaticResource BooleanToVisibilityConverter}}" />

        <DataGrid ColumnWidth="*"
                  ItemsSource="{Binding ItemsCollection}"
                  Visibility="{Binding ShowHtmlContent,
                                       Converter={StaticResource BooleanToVisibilityInverseConverter}}" />

        <Grid Grid.Row="1" Margin="0,12">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <TextBox MinWidth="300" Text="{Binding Weburl, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />

            <Button Grid.Column="1"
                    MinWidth="60"
                    HorizontalAlignment="Right"
                    Command="{Binding ResolveCommand}"
                    Content="resolve"
                    Visibility="{Binding ShowHtmlContent,
                                         Converter={StaticResource BooleanToVisibilityConverter}}" />

            <Button Grid.Column="1"
                    MinWidth="60"
                    HorizontalAlignment="Right"
                    Command="{Binding EditCommand}"
                    Content="edit"
                    Visibility="{Binding ShowHtmlContent,
                                         Converter={StaticResource BooleanToVisibilityInverseConverter}}" />
        </Grid>


    </Grid>
</Page>